<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const list = document.querySelector('list')//获取父元素 整个ul
        const line = document.querySelector('k') //获取整条线 下面灰色的
        list.addEventListener('click', function (e) {
            //这个操作代表要获取到a元素 就那些下面的每个a
            if (e.target.tagName === 'A') {
                line.style.transform = `translateX(${e.target.offsetLeft}px)`
                //然后再添加一个transition到style
            }
        })

    </script>
</body>

</html>